/*
 * @Descripttion: 命令基类（编辑的对象）
 * @Author: 人生只如初见
 * @Date: 2021-09-23 17:01:37
 * @LastEditors: 人生只如初见
 * @LastEditTime: 2021-09-24 11:10:33
 */
export default class Command {
  constructor(editor) {
    this.id = -1;
    this.inMemory = false; //命令是否放入队列中允许撤销和重做
    this.type = ''; //命令的类型
    this.name = ''; //命令的名称
    this.editor = editor;
  }
  toJSON() {
    //返回对象
    var output = {};
    output.type = this.type;
    output.id = this.id;
    output.name = this.name;
    return output;
  }
  fromJSON(json) {
    this.inMemory = true;
    this.type = json.type;
    this.id = json.id;
    this.name = json.name;
  }
}

